<template>
  <div class="home">
    <el-container>
      <el-aside width="200px">
        <h1>后台管理系统平台</h1>
        <el-menu router active-text-color="#8B9E77" background-color="#2C3135" class="el-menu-vertical-demo" default-active="1"
          text-color="#fff" @open="handleOpen" @close="handleClose">
          <el-menu-item index="/user">
            <el-icon>
              <User />
            </el-icon>
            <span>用户列表</span>
          </el-menu-item>
          <el-menu-item index="/role">
            <el-icon>
              <Tickets />
            </el-icon>
            <span>角色列表</span>
          </el-menu-item>
          <el-menu-item index="/dept">
            <el-icon>
              <OfficeBuilding />
            </el-icon>
            <span>部门列表</span>
          </el-menu-item>
          <el-menu-item index="/home">
            <el-icon>
              <setting />
            </el-icon>
            <span>设置</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" background-color="#5D7B8B"
            text-color="#fff" active-text-color="#8B9E77" @select="handleSelect">
            <el-menu-item index="1">Processing Center</el-menu-item>
            <el-menu-item index="2">Processing Center</el-menu-item>
            <el-menu-item index="3">Processing Center</el-menu-item>
            <el-sub-menu index="4">
              <template #title>Workspace</template>
              <el-menu-item index="4-1">item one</el-menu-item>
              <el-menu-item index="4-2">item two</el-menu-item>
              <el-menu-item index="4-3">item three</el-menu-item>
            </el-sub-menu>
          </el-menu>
        </el-header>
        <el-main><RouterView></RouterView></el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup lang='ts'>
import { ref } from 'vue'
import { User, Tickets, OfficeBuilding, Setting } from '@element-plus/icons-vue'

const activeIndex = ref('1')
const handleSelect = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
const handleOpen = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
const handleClose = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
</script>

<style scoped lang="scss">
.home {
  width: 100vw;
  height: 100vh;

  .el-aside {
    background-color: #2C3135;
    height: 100vh;

    h1 {
      font-family: 月星楷-bold;
      text-align: center;
      color: #fff;
      margin-top: 20px;
      margin-bottom: 20px;
    }

    .el-menu {
      border-right: none;
    }
  }

  .el-header {
    padding: 0;
    .el-menu{
      display: flex;
      justify-content: end;
    }
  }
  .el-main{
    padding: 0;
  }



}
</style>
